﻿Imports System.Data.OleDb

Public Class DiscussionForum
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
    End Sub

    Protected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnsubmit.Click
        Dim sql As String = "INSERT INTO Discussion (Title,DateCreated,UserIDFK) VALUES (@f1,@f2,@f3)"
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)
        cmd.Parameters.AddWithValue("@f1", txtmaintenancedescription.Text)
        cmd.Parameters.AddWithValue("@f2", Now.Date.ToString("dd/MM/yyyy"))
        cmd.Parameters.AddWithValue("@f3", Membership.GetUser(User.Identity.Name).ProviderUserKey)
        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Response.Redirect("DiscussionForum.aspx")
    End Sub
End Class